package com.xcx.robot.mirai.entity.team;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.xcx.robot.mirai.entity.BaseEntity;
import com.xcx.robot.mirai.key.PositionLocation;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @Author: 邢晨旭
 * @Date: 2021/6/9 13:59
 * @Description:
 */
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("team_info")
public class TeamInfo extends BaseEntity {
    /**
     * id
     * 所属团队id
     * 队列编号 1队
     * 队列位置 1号
     * 职业类别（内外dps 奶 t 老板）0外 1内 2奶 3t 4老板
     * 职业图片
     * 报名人qq
     * 报名人昵称
     * 帮报名人（管理员 默认为空）
     * 索引 1-25
     */
    @TableId
    private Long id;
    private Long teamId;
    private Integer queue;
    private Integer qNumber;
    private Integer type;
    private String profession;
    private String url = PositionLocation.getUrl();
    private Long applicant;
    private String applicantName = "小白兔兔";
    private Long applicant2;
    private Integer qIndex;

    public TeamInfo() {
    }

    public TeamInfo(Integer queue, Integer qNumber, String url, Integer qIndex) {
        this.queue = queue;
        this.qNumber = qNumber;
        this.url = url;
        this.qIndex = (queue - 1) * 5 + qNumber;
    }

    public TeamInfo(Long teamId, PositionLocation positionLocation, Long applicant, String applicantName) {
        this.teamId = teamId;
        this.queue = positionLocation.location / 5 + 1;
        this.qNumber = positionLocation.location % 5;
        this.type = positionLocation.type;
        this.profession = positionLocation.fullName;
//        this.url = TeamInfoCommon.IMG_URL + positionLocation.url;
        this.applicant = applicant;
        this.applicantName = applicantName;
        this.qIndex = positionLocation.location;
    }

    public TeamInfo(Long teamId, PositionLocation positionLocation, Integer index, Long applicant, String applicantName) {
        this.teamId = teamId;
        this.queue = index / 5 + 1;
        this.qNumber = index % 5;
        this.type = positionLocation.type;
        this.profession = positionLocation.fullName;
//        this.url = TeamInfoCommon.IMG_URL + positionLocation.url;
        this.applicant = applicant;
        this.applicantName = applicantName;
        this.qIndex = index;
    }

    public Integer index() {
        return (this.queue - 1) * 5 + this.qNumber;
    }

    public static void main(String[] args) {
        System.out.println(1 / 5);
        System.out.println(1 % 5);
        System.out.println(7 / 5);
        System.out.println(7 % 5);
    }
}
